﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.MobileControls;

public partial class ObjectList_ObjectListOnShowItemsExample : System.Web.UI.MobileControls.MobilePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.ObjectList1.ItemCommand += new ObjectListCommandEventHandler(this.Team_OnItemCommand);
        this.ObjectList1.ShowItemCommands += new ObjectListShowCommandsEventHandler(this.SetItemCommands);
    }
    private void Team_OnItemCommand( Object sender, ObjectListCommandEventArgs e)
    {
        this.ActiveForm = Form2;
        if (e.CommandName == "ChampsCup")
        {         
            Label1.Text = "Champions Cup 2003";
            Label2.Text = e.ListItem["ChampionsCup"];
        }
        else if (e.CommandName == "InterCityCup")
        {            
            Label1.Text = "Inter-City Cup 2003";
            Label2.Text = e.ListItem["InterCup"];
        }
    }
    private void SetItemCommands(Object sender, ObjectListShowCommandsEventArgs e)
    {        
        if (e.ListItem["ChampionsCup"] == "")
            e.Commands.Remove("ChampsCup");

        if (e.ListItem["InterCup"] == "")
            e.Commands.Remove("InterCityCup");
    }
}